package appapi.service.impl;

import appapi.Request.Basic.MaintenanItemReq;
import appapi.Request.SelfItemReq;
import appapi.dao.MaintenanitemMapper;
import appapi.dao.SelfcheckitemMapper;
import appapi.entity.basic.MaintenanItemEntity;
import appapi.entity.basic.OperatingTypeEntity;
import appapi.entity.basic.SelfcheckItemEntity;
import appapi.service.MaintenanItemService;
import appapi.service.SelfCheckItemService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/26 15:15
 */
@Service
public class MaintenanItemServiceImpl extends ServiceImpl<MaintenanitemMapper, MaintenanItemEntity> implements MaintenanItemService {

    @Resource
    private MaintenanitemMapper maintenanitemMapper;

    @Override
    public List<MaintenanItemEntity> list(MaintenanItemReq req) {
        return maintenanitemMapper.queryList(req);
    }

    @Override
    public MaintenanItemEntity detail(Long selfItemId) {
        return maintenanitemMapper.selectDetail(selfItemId);
    }

    @Override
    public int count(MaintenanItemEntity entity) {
        return maintenanitemMapper.count(entity);
    }

    @Override
    public int insert(MaintenanItemEntity entity) {
        return maintenanitemMapper.insert(entity);
    }

    @Override
    public int update(MaintenanItemEntity entity) {

        return maintenanitemMapper.updateByEntity(entity);
    }

    @Override
    public int delete(Long maintemId) {
        MaintenanItemEntity entity = maintenanitemMapper.selectDetail(maintemId);
        if (entity == null) {
            return -1;
        }

        return maintenanitemMapper.deleteByPrimaryKey(maintemId);
    }
}
